package me.heizi.springboot.students.controllers.dto

import me.heizi.springboot.students.config.GlobalBeans.findByName
import me.heizi.springboot.students.entities.User
import me.heizi.springboot.students.model.UserType

data class UserDTO(
    var password:String?=null,
    var phone:String?=null,
    var remark:String?=null,
    var classId:Int?=null,
) {
    constructor():this(null)

    fun toUser(user:User): User = User(
        id =user.id,
        username = user.username,
        realName = user.realName,
        password = password!!,
        phone = phone!!,
        remark = remark,
        typeId = user.type.id,
        classId =classId!!
    )
}